package edu.psu.geovista.app.pcp.toolkits.selectcontrol;
/*
 * All buttons ( up, down, select, deselect,..., apply in the single pane
 *
 * Created on April 22, 2004, 12:25 PM
 */

import javax.swing.*;
import java.awt.event.ActionListener;
import java.util.Enumeration;
import java.util.Hashtable;

/**
 *
 * @author  jinchen
 */
public class SingleButtonsPane extends javax.swing.JPanel {
    Hashtable btns=new Hashtable();
    /** Creates new form BtnPane */
    public SingleButtonsPane() {
        initComponents();
        setup();
    }
    private void setup(){
        btns.put(applyBtn.getName() ,applyBtn);
        btns.put(bottom.getName() ,bottom);
        btns.put(down.getName() ,down);
        btns.put(left.getName() ,left);
        btns.put(leftAll.getName() ,leftAll);
        btns.put(right.getName() ,right);
        btns.put(rightAll.getName() ,rightAll);
        btns.put(top.getName() ,top);
        btns.put(up.getName() ,up);


    }
    public void addActionListnerForAll(ActionListener al) {
        Enumeration en = btns.elements();
        while (en.hasMoreElements()) {
            JButton btn = (JButton) en.nextElement();
            btn.addActionListener(al);

        }
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        java.awt.GridBagConstraints gridBagConstraints;

        mainp = new javax.swing.JPanel();
        horizonPane = new javax.swing.JPanel();
        left = new javax.swing.JButton();
        right = new javax.swing.JButton();
        leftAll = new javax.swing.JButton();
        rightAll = new javax.swing.JButton();
        verticalPane = new javax.swing.JPanel();
        up = new javax.swing.JButton();
        top = new javax.swing.JButton();
        down = new javax.swing.JButton();
        bottom = new javax.swing.JButton();
        controlp = new javax.swing.JPanel();
        applyBtn = new javax.swing.JButton();

        setLayout(new java.awt.GridBagLayout());

        mainp.setLayout(new java.awt.GridBagLayout());

        horizonPane.setLayout(new java.awt.GridBagLayout());

        horizonPane.setBorder(new javax.swing.border.EtchedBorder());
        left.setText(" < ");
        left.setToolTipText("Hide an variable");
        left.setMargin(new java.awt.Insets(2, 2, 2, 2));
        left.setMaximumSize(new java.awt.Dimension(25, 25));
        left.setMinimumSize(new java.awt.Dimension(25, 25));
        left.setName("Hide");
        left.setPreferredSize(new java.awt.Dimension(25, 25));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        horizonPane.add(left, gridBagConstraints);

        right.setText(">");
        right.setToolTipText("Show an variable");
        right.setMargin(new java.awt.Insets(2, 2, 2, 2));
        right.setMaximumSize(new java.awt.Dimension(25, 25));
        right.setMinimumSize(new java.awt.Dimension(25, 25));
        right.setName("Show");
        right.setPreferredSize(new java.awt.Dimension(25, 25));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        horizonPane.add(right, gridBagConstraints);

        leftAll.setText("<<");
        leftAll.setToolTipText("Hide all variables");
        leftAll.setFocusable(false);
        leftAll.setMargin(new java.awt.Insets(2, 2, 2, 2));
        leftAll.setMaximumSize(new java.awt.Dimension(25, 25));
        leftAll.setName("Hide all");
        leftAll.setPreferredSize(new java.awt.Dimension(25, 25));
        leftAll.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                leftAllActionPerformed(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        horizonPane.add(leftAll, gridBagConstraints);

        rightAll.setText(">>");
        rightAll.setToolTipText("Show all variables");
        rightAll.setMargin(new java.awt.Insets(2, 2, 2, 2));
        rightAll.setName("Show all");
        rightAll.setPreferredSize(new java.awt.Dimension(25, 25));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        horizonPane.add(rightAll, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        mainp.add(horizonPane, gridBagConstraints);

        verticalPane.setLayout(new java.awt.GridBagLayout());

        verticalPane.setBorder(new javax.swing.border.EtchedBorder());
        up.setToolTipText("Move up");
        up.setLabel("^");
        up.setMargin(new java.awt.Insets(2, 2, 2, 2));
        up.setMaximumSize(new java.awt.Dimension(25, 25));
        up.setMinimumSize(new java.awt.Dimension(25, 25));
        up.setName("Up");
        up.setPreferredSize(new java.awt.Dimension(25, 25));
        up.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                upActionPerformed(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        verticalPane.add(up, gridBagConstraints);

        top.setText("^ ^");
        top.setToolTipText("Move to top");
        top.setMargin(new java.awt.Insets(1, 1, 1, 1));
        top.setName("Top");
        top.setPreferredSize(new java.awt.Dimension(25, 25));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        verticalPane.add(top, gridBagConstraints);

        down.setFont(new java.awt.Font("MS Sans Serif", 0, 10));
        down.setToolTipText("Move down");
        down.setLabel("v");
        down.setMargin(new java.awt.Insets(2, 2, 2, 2));
        down.setMaximumSize(new java.awt.Dimension(25, 25));
        down.setMinimumSize(new java.awt.Dimension(25, 25));
        down.setName("Down");
        down.setPreferredSize(new java.awt.Dimension(25, 25));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        verticalPane.add(down, gridBagConstraints);

        bottom.setFont(new java.awt.Font("MS Sans Serif", 0, 10));
        bottom.setText("v v");
        bottom.setToolTipText("Move to bottom");
        bottom.setMargin(new java.awt.Insets(2, 2, 2, 2));
        bottom.setMaximumSize(new java.awt.Dimension(25, 25));
        bottom.setMinimumSize(new java.awt.Dimension(25, 25));
        bottom.setName("Bottom");
        bottom.setPreferredSize(new java.awt.Dimension(25, 25));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        verticalPane.add(bottom, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        mainp.add(verticalPane, gridBagConstraints);

        add(mainp, new java.awt.GridBagConstraints());

        applyBtn.setText("apply");
        applyBtn.setName("Apply");
        applyBtn.setPreferredSize(new java.awt.Dimension(70, 25));
        applyBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                applyBtnActionPerformed(evt);
            }
        });

        controlp.add(applyBtn);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        add(controlp, gridBagConstraints);

    }//GEN-END:initComponents

    private void upActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_upActionPerformed

    private void leftAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_leftAllActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_leftAllActionPerformed

    private void applyBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyBtnActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_applyBtnActionPerformed
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton applyBtn;
    private javax.swing.JButton bottom;
    private javax.swing.JPanel controlp;
    private javax.swing.JButton down;
    private javax.swing.JPanel horizonPane;
    private javax.swing.JButton left;
    private javax.swing.JButton leftAll;
    private javax.swing.JPanel mainp;
    private javax.swing.JButton right;
    private javax.swing.JButton rightAll;
    private javax.swing.JButton top;
    private javax.swing.JButton up;
    private javax.swing.JPanel verticalPane;
    // End of variables declaration//GEN-END:variables
    
}
